package com.taglab.chic.atom;

import com.taglab.chic.atom.Text;
import com.taglab.chic.atom.Content;

import java.util.Date;

/**
 * @author Markus Kobler
 */
public class AtomEntry extends BaseAtomElement {

  private static final long serialVersionUID = -2696923960038611202L;

  private Content content;
  
  // recomended
  private Text summary;

  // optional
  private Date published;
  private AtomSource source;

  public AtomEntry(String id, String title) {
    this(id, title, new Date());
  }
  
  public AtomEntry(String id, String title, Date updated) {
    super(id, title);
    this.updated = updated;
  }

  public AtomEntry(String id, String title, String summary) {
    this( id, title, new Date(), summary);
  }

  public AtomEntry(String id, String title, Date updated, String summary) {
    super(id, title);
    this.updated = updated;
    setSummary(summary);
  }

  public Content getContent() {
    return content;
  }

  public void setContent(Content content) {
    this.content = content;
  }

  public void setContent(String content) {
    this.content = content != null ? new Content(content) : null;
  }

  public Text getSummary() {
    return summary;
  }

  public void setSummary(Text summary) {
    this.summary = summary;
  }

  public void setSummary(String summary) {
    this.summary = summary != null ? new Text(summary) : null;
  }

  public Date getPublished() {
    return published;
  }

  public void setPublished(Date published) {
    this.published = published;
  }

  public AtomSource getSource() {
    return source;
  }

  public void setSource(AtomSource source) {
    this.source = source;
  }
  
}
